<?php

class Testing2 extends MY_Controller {

	function __construct() {
		parent::__construct();
	}
	
	public function index(){
	}
	
	public function test() {
		$update_time = date('Y-m-d H:i:s');
		$facebook = new Facebook();
		
	
		$this->load->model('emailgenerator_model');
		$this->load->model('user_model');
		
		$user_with_newsletter = $this->emailgenerator_model->get_user_with_newsletter();
		$i = 0;
		foreach ($user_with_newsletter as $user)  {
			echo $user['fb_id'] . '<br />';
			/*
			$time_diff = strtotime($update_time) - strtotime($user['last_newsletter']);
			echo $i++ . "<br />";
			//echo $time_diff . "<br />";
			//echo ($time_diff/24/60/60) . "<br />";
			$fb_account = $facebook->api('/' . $user['fb_id'],'GET');

			if ($user['newsletter_day'] && ($time_diff > $user['newsletter_day']*24*60*60)) {
				$message = '
						<p> Dear ' . $fb_account['name'] . ', 
						</p>
						
						<p> Here are the latest updates from  
							<a href="'.base_url().'">The Trove</a>. 
						</p><br />';
				
				
				
				echo $message;
				
				
			} */
		}	
	}
	
}